from models.product import Product


class  ProductRepository:
    def __init__(self, db):
        self.db = db

    def create_or_update_product(self, product: Product) -> Product:
        self.db.add(product)
        self.db.commit()
        self.db.refresh(product)
        return product